﻿@model IEnumerable<wh40klbWeb.Models.SpecialRuleViewModel>
@{
    ViewBag.Title = "Index";
}
<h2>
    Index</h2>
<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            Nom
        </th>
        <th>
            Armées
        </th>
        <th>
            unitées
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @if (item.Armies != null)
                {
                    foreach (var a in item.Armies)
                    {
                    <text> @Html.ActionLink(a.Name, "Details", "Army", new { id = a.Id }, null) - 
                    </text>
                    }
                }
            </td>
            <td>
                @if (item.Infantries != null)
                {
                    foreach (var infantry in item.Infantries)
                    {
                    <text> @Html.ActionLink(infantry.Name, "Details", "Infantry", new { id = infantry.Id }, null) -
                    </text>
                    }
                }
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                @Html.ActionLink("Details", "Details", new { id = item.Id }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.Id })
            </td>            
        </tr>
    }
</table>
